package com.woniuxy.yogaapp.service.imp;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.woniuxy.yogaapp.mapper.PocketMapper;
import com.woniuxy.yogaapp.pojo.Pocket;
import com.woniuxy.yogaapp.service.PocketService;

import lombok.Data;

@Service
@Data
@Transactional
public class PocketServiceImp implements PocketService {
	@Resource
	private PocketMapper pocketMapper;

	@Override
	public Pocket findPocketByPuid(Pocket pocket) {

		return pocketMapper.findPocketByPuid(pocket);
	}

	@Override
	public String addPocket(Pocket pocket) {
		String result = "开通失败！";
		int row = pocketMapper.addPocket(pocket);
		if (row == 1) {
			result = "开通成功！";
		}
		return result;
	}

	@Override
	public int rechargeMoney(Pocket pocket) {

		return pocketMapper.rechargeMoney(pocket);
	}

	@Override
	public String bindingBankCard(Pocket pocket) {
		String result="绑定失败！";
	int row=	pocketMapper.bindingBankCard(pocket);
	if(row==1){
		result="绑定成功！";
	}
		return result;
	}

	@Override
	public String withdrawal(Pocket po) {
		String result="提现失败！";
	int row=	pocketMapper.withdrawal(po);
		if(row==1){
			result="提现成功！";
		}
		
		return result;
	}

	@Override
	public void updateOrdernumber(Pocket pocket) {
		pocketMapper.updateOrdernumber(pocket);
		
	}

	@Override
	public int findPuidByOrdernumber(String ordernumber) {
		
		
		return pocketMapper.findPuidByOrdernumber(ordernumber);
	}}
